import java.util.PriorityQueue;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 徐海涛
 * Date: 2022-02-13
 * Time: 11:03
 */
public class TestDemo {
    public static void main2(String[] args) {
        // 堆的 优先级队
        //默认是小根堆
        PriorityQueue<Integer> priorityQueue = new PriorityQueue<>();
        //每放一个元素 都得保证当前的堆是大堆 或者是 小堆M
        priorityQueue.offer(12);
        priorityQueue.offer(3);
        priorityQueue.offer(15);
        System.out.println(priorityQueue.peek());//顶元素是3，小堆
        System.out.println(priorityQueue.poll());//每次弹出一个元素之后，仍然是
        //小根堆 或者大根堆
        System.out.println(priorityQueue.poll());
    }
    public static void main(String[] args) {
        int[] array = {27,15,19,18,28,34,65,49,25,37};
        TestHeap testHeap = new TestHeap();
        testHeap.createHeap(array);
        testHeap.heapSort();
        System.out.println("========");
    }
}
